﻿/// <reference path="SimpleControl.js" />

var ____a;

var $RadioGroup = TA.Turbo.Controls.RadioGroup = function RadioGroup(clientId)
{
	this.SimpleControl(clientId);
}
$RadioGroup.Inherit($SimpleControl);

if (____a)
{
	$RadioGroup.prototype = new $SimpleControl();
	$RadioGroup.prototype.SimpleControl = new $SimpleControl();

	$RadioGroup.prototype._buttons = new Array();
}

$RadioGroup.prototype.get_Value = function get_Value()
{
	var b = this._buttons, bl = b.length;
	for (var i = 0; i < bl; ++i)
	{
		if (b[i].checked)
			return b[i].value;
	}
	return null;
}
$RadioGroup.prototype.set_Value = function set_Value(value)
{
	var b = this._buttons, bl = b.length;
	for (var i = 0; i < bl; ++i)
	{
		b[i].checked = b[i].value == value;
	}
}

$RadioGroup.prototype.Init = function Init()
{
	this.BaseControl.Init.call(this);

	this._buttons = new Array();
	var t = document.getElementsByName(this.get_Control().name);
	for (var i = 0; i < t.length; ++i)
	{
		this._buttons.push(t[i]);
		t[i].AddEvent("change", this._OnValueChanged, this);
	}
}